The task of fulfilling a dynamic memory allocation request consists of locating a block of unused memory of sufficient size. Memory requests are satisfied by allocating portions of memory from a large pool of memory called the heap or free store. At any given time, some parts of the heap are in use, while some are free and available for future allocations. When available memory levels run low, system operation can be slow. For example, it can take longer to find an available amount of memory large enough to meet an application request.
Garbage collection is a form of automatic memory management. A garbage collector attempts to reclaim memory occupied by objects that are no longer in use by applications (e.g., memory that is no longer referenced by any application pointers, memory associated with data structures indicated as no longer in use). In addition to applications generally slowing down due to low memory levels, garbage collection also slows down based on a need to monitor and perform reclamations on larger numbers of objects (e.g., more memory to mark and sweep). This can further slow system operation.
A graphical user interface (GUI) of an application built using a dynamic language having runtime type checking, such as Java or JavaScript, may be made up of several layers of containers, herein referred to as a containment hierarchy. In one example, the first layer is a window used to contain an application, herein referred to as a top-level container. Subsequent levels can include graphical components (e.g., text boxes, labels, buttons), with properties of those graphical components forming even lower layers. In some instances, containment hierarchies can become quite large.
The containment hierarchy of many real-world applications contains a large number of content objects. For example, a single scrolling list of 100 cells, with each cell using five content objects to draw, requires 502 content objects. Once a containment hierarchy is created, many of these content objects are never again referenced. This large mass of seldom referenced objects can significantly slow system performance.